#!/bin/bash

# 环境检测
if [[ $DEEPIN_SIGN_KEY == "" ]]; then
  echo "❌ 未检测到签名证书"
  exit 1
fi

# DEB包签名
sign_deb() {
  dpkg-sig -k $DEEPIN_SIGN_KEY \
    --sign builder $1
}

# 玲珑包签名
sign_uab() {
  ll-cli sign $1 \
    --key $DEEPIN_SIGN_KEY \
    --cert /etc/deepin/certs/store.crt
}

case $1 in
  *.deb) sign_deb $1 ;;
  *.uab) sign_uab $1 ;;
  *) echo "⚠️  未知包格式" ;;
esac